﻿<UserControl x:Class="SilverlightTowns.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:SilverlightTowns.Web" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" DataContext="{Binding}">

    <StackPanel x:Name="LayoutRoot" Background="White" DataContext="{Binding}">
        <Button Content="Save" Click="ButtonSave_Click" />
        <riaControls:DomainDataSource AutoLoad="True" 
                                      d:DesignData="{d:DesignInstance my:Country, CreateList=true}" 
                                      Height="0" LoadedData="countryDomainDataSource_LoadedData_1" 
                                      Name="countryDomainDataSource" QueryName="GetCountriesQuery" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:DomainServiceTown x:Name="DomainServiceTown123"  />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <sdk:DataGrid 
            AutoGenerateColumns="False" Height="200" ItemsSource="{Binding ElementName=countryDomainDataSource, Path=Data, Mode=TwoWay}" Name="countryDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" Width="400">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn x:Name="continentIDColumn" Binding="{Binding Path=ContinentID, Mode=TwoWay}" Header="Continent ID" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="countrieIDColumn" Binding="{Binding Path=CountrieID, Mode=OneWay}" Header="Countrie ID" IsReadOnly="True" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="languageColumn" Binding="{Binding Path=Language, Mode=TwoWay}" Header="Language" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="nameColumn" Binding="{Binding Path=Name, Mode=TwoWay}" Header="Name" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="populationColumn" Binding="{Binding Path=Population, Mode=TwoWay}" Header="Population" Width="SizeToHeader" />
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
    </StackPanel>
</UserControl>
 